01 knapsack by dynamic programming